#ifndef PURCHASEDINGDANSTANDARDITEMMODEL_H
#define PURCHASEDINGDANSTANDARDITEMMODEL_H

#include <QStandardItemModel>
#include "historyproduct.h"
#include "dingdandetail.h"

class PurchaseDingdanStandardItemModel : public QStandardItemModel
{
    Q_OBJECT
public:
    explicit PurchaseDingdanStandardItemModel(QObject *parent = nullptr);

    QStringList header;

    bool setData(const QModelIndex &index, const QVariant &value, int role) override;

    QVariant data(const QModelIndex &index, int role) const override;

    void reset();

    void insertHistoryProduct(HistoryProduct &historyProduct);

    void insertHistoryProduct(QList<HistoryProduct*> historyProducts);

    void insertProduct(Product *product);

    void insertProduct(QList<Product*> products);

    void refresh();

    QList<DingdanDetail*> getDingdanDetails();
signals:
    void refreshTotalPlanCount(int totalPlanCount);

public slots:

private:
    QList<HistoryProduct*> historyProducts;
    QList<DingdanDetail*> details;
    QList<Product*> products;
};

#endif // PURCHASEDINGDANSTANDARDITEMMODEL_H
